/**
 * @filename:SysUserController 2025-05-09
 * @project starhub-schema  V1.0
 */
package com.starhub.app.sys.user;

import com.starhub.engine.sys.user.service.SysUserService;
import com.starhub.common.bean.ResultResp;
import com.starhub.common.security.util.SecurityUtils;
import com.starhub.common.sys.user.LoginUser;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>说明： 用户设置API接口层</P>
 * @version: V1.0
 * @author: luosw
 * @time    2025-05-09
 *
 */
@Api(value="用户设置移动端接口", tags = {"用户设置移动端接口"},description = "编写者:luosw" )
@RestController
@RequestMapping("/app/starhub/sysUser")
public class SysUserAppController {
    @Autowired
    private SysUserService sysUserService;
    /**
    * 日志
    */
    private static final Logger log = LoggerFactory.getLogger(SysUserAppController.class);


    /**
    * 用户设置信息获取
    */
    @ApiOperation(value = "用户设置信息获取", notes = "用户设置信息获取")
    @GetMapping("/getInfo/{id}")
    public ResultResp getInfo(@PathVariable Long id){
        ResultResp ResultResp = null;
        try {
            LoginUser user = SecurityUtils.getCurrentUser();
            ResultResp = ResultResp.success(sysUserService.getInfo(user, id));
        }catch (Exception e){
            log.error(ExceptionUtils.getStackTrace(e));
            ResultResp = ResultResp.fail(e.getMessage(),e);
        }
        return ResultResp;
    }


}